<%@ page language="java" import="java.util.*;" pageEncoding="UTF-8"%>
<%@include file="/jsp/common/inc_default_header.jspf"%>
<html:form action="/ProjectList">
<%@include file="/jsp/common/header.jspf"%>
<!-- Start Content -->
<div id="pages">
<Table width="100%">
  	<tr><td><h1>
		Virtium Project Management
	</h1></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>
		<div id="divAdLeft" style="display: block; left: 0pt; width: 120px; position: absolute; top: 228px;" align="left">
			<br/><br/><br/><br/><br/><br/><br/><br/>
			<a>Quick Access Project
			</a>
			<br/>
			<table>
			<tr><td><div align="left" id="treeContainer">Tree container</div></td></tr>
			</table>
		</div>
		<c:choose>
			<c:when test="${projectForm.userSession.username != ''}">
				 <A id="add_new_project" href="#">Add New Project</A>
			</c:when>
			<c:otherwise>							
			</c:otherwise>
		</c:choose>		
		<div id="columnshowhide">
		</div>
		<div id="content">
		</div>
		<div id="tables" style="width: 900px; padding-right: 100">
		</div>
	</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td></tr>
</Table>
<Table width="100%">  	
	<tr><td>
		<div id="loginDialog" class="inprogress">
		<div class="hd">
			Login
		</div>
		<div class="bd">			
				<div class="smallTitle">
					<big><b>Welcome to the Virtium Projects Management System</b>
					</big>
				</div>
				<br />
				<div class="smallText">
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td style="width: 80px">
								<label for="username">
									Name:
								</label>
							</td>
							<td>
								<input id="username" maxlength="30" size="40" type="text" />
							</td>
						</tr>
						<tr>
							<td>
								<label for="password">
									Password:
								</label>
							</td>
							<td>
								<input id="password" maxlength="30" size="40" type="password" />
							</td>
						</tr>
						<tr>
							<td colspan="2" height="25">
								<div align="right">
									<input onclick="return checkLoginForm();" type="button"
										value="Submit" />
									<input type="reset" value="Reset" />
								</div>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<div id="loginError">
								</div>
							</td>
						</tr>
					</table>
				</div>
			
		</div>
	</div>
	
	
		
	
	</td></tr>
	<tr><td><!-- Start Add new Major Task Dialog -->
		<div id="AddNewMajorDialog" class="inprogress">
			<div class="hd">
				MajorTaks
			</div>
			<div class="bd">
				<div class="smallTitle">
					<big><b>Add New MajorTaks</b> </big>
				</div>
				<br />
				<div class="smallText">
					<table border="0" cellpadding="1" cellspacing="2">
						<tr>
							<td style="width: 80px; height: 26px;">
								<label for="selectProjectType">
									<strong>Type:</strong>
								</label>
							</td>
							<td style="width: 155px; height: 26px;">
								<input type="text" readonly="readonly" id="txtTypeNewMajorTask" />
								<input type="hidden" id="txtTypeNewMajorTaskID" />
							</td>
							<td style="height: 26px">
								<label for="txtCost">
									&nbsp;
									<strong>Cost:</strong>
								</label>
							</td>
							<td style="height: 26px">
								<input id="txtCost" name="txtCost" type="text" />
							</td>
						</tr>
						<tr>
							<td style="width: 80px">
								<label for="editor_majorTask">
									<strong>Major Task:</strong>
								</label>
							</td>
							<td style="width: 155px">
								<textarea id="editor_majorTask" cols="40"
									name="editor_majorTask" rows="10"> 								
								</textarea>
							</td>
							<td>
								<label for="editor_keyIssues">
									&nbsp;
									<strong> Key Issues:</strong>
								</label>
							</td>
							<td>
								<textarea id="editor_keyIssues" cols="40"
									name="editor_keyIssues" rows="10"> 								
								</textarea>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<table width="292" height="170" style="width: 425px; height: 176px;">
									<tr>
										<td style="width: 80px">
											<label for="selectUser">
												<strong>Owner:</strong>
											</label>
										</td>
										<td>
											<select id="selectUser" name="selectUser" style="">
												<c:forEach var="row" items="${projectForm.userCol}"
													varStatus="rowStatus">
													<option value="<c:out value="${row.id}"/>">
														<c:out value="${row.fullName}" />
													</option>
												</c:forEach>
											</select>
										</td>
									</tr>
									<tr>
										<td style="width: 80px">
											<label for="chkAchived">
												<strong>Achived: </strong>
											</label>
										</td>
										<td>
											<input id="chkAchived" name="chkAchived" type="checkbox" />
										</td>
									</tr>
									<tr>
										<td style="width: 80px">
											<label for="startDate">
												<strong>Start Date:</strong>
											</label>
										</td>
										<td>
											<div class="box">
												<div class="datefield">
													<input id="startDate" name="startDate" type="text" value="" readonly="readonly" />
													<button id="showStartDate" title="Show Calendar"
														type="button">
														<img alt="Calendar" height="18"
															src="<%=request.getContextPath()%>/js/yui/assets/calbtn.gif"
															width="18">
													</button>
												</div>
											</div>
										</td>
									</tr>
									<tr>
										<td>
											<label for="finishDate">
												<strong>Finish Date: </strong>
											</label>
										</td>
										<td>
											<div class="box">
												<div class="datefield">
													<input id="finishDate" name="finishDate" type="text"
														value="" readonly="readonly" />
													<button id="showFinishDate" title="Show Calendar"
														type="button">
														<img alt="Calendar" height="18"
															src="<%=request.getContextPath()%>/js/yui/assets/calbtn.gif"
															width="18">
													</button>
												</div>
											</div>
										</td>
									</tr>
									<tr>
										<td>
											<label for="sPriority">
												<strong>Priority: </strong>
											</label>
										</td>
										<td>
											<select id="sPriority" name="sPriority">
												<option value="0">0</option>
												<option value="1">1</option>
												<option value="2">2</option>
												<option value="3">3</option>
												<option value="4">4</option>
												<option value="5">5</option>
											</select>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<label for="editor_decision">
									&nbsp;
									<strong>Decision Need: </strong>
								</label>
							</td>
							<td>
								<textarea id="editor_decision" cols="40" name="editor_decision"
									rows="10"> 								
								</textarea>
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<div align="right">
									<input id="tableIndex" type="hidden" />
									<input onclick="addNewMajorTask();" type="button"
										value="Submit" />
								</div>
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<div id="newMajorTaskError">
								</div>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	<!-- End Add new Major Task Dialog --></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><!-- Start Add new project Dialog -->
		<div id="AddNewVPMProjectDialog" class="inprogress">
			<div class="hd">
				Project
			</div>
			<div class="bd">
				<div class="smallTitle">
					<big><b>Add New Project</b> </big>
				</div>
				<br />
				<div class="smallText">
					<table border="0" cellpadding="1" cellspacing="2">
						<tr>
							<td style="width: 80px; height: 26px;">
								<label for="prSelectProjectType">
									<strong>Type:</strong>
								</label>
							</td>
							<td style="width: 155px; height: 26px;">
								<select id="prSelectProjectType" name="prSelectProjectType"
									style="">
									<c:forEach var="row" items="${projectForm.projectTypeCol}"
										varStatus="rowStatus">
										<option value="<c:out value="${row.id}"/>">
											<c:out value="${row.name}" />
										</option>
									</c:forEach>
								</select>
							</td>
							<td style="height: 26px">
								<label for="prTxtCost">
									&nbsp;
									<strong>Cost:</strong>
								</label>
							</td>
							<td style="height: 26px">
								<input id="prTxtCost" name="prTxtCost" type="text" />
							</td>
						</tr>
						<tr>
							<td style="width: 80px">
								<label for="prEditor_majorTask">
									<strong>Major Task:</strong>
								</label>
							</td>
							<td style="width: 155px">
								<textarea id="prEditor_majorTask" cols="40"
									name="prEditor_majorTask" rows="10"> 								
								</textarea>
							</td>
							<td>
								<label for="prEditor_keyIssues">
									<strong> Key Issues:</strong>
								</label>
							</td>
							<td>
								<textarea id="prEditor_keyIssues" cols="40"
									name="prEditor_keyIssues" rows="10"> 								
								</textarea>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<table width="426" height="191">
									<tr>
										<td style="width: 80px">
											<label for="prSelectUser">
												<strong>Owner:</strong>
											</label>
										</td>
										<td>
											<select id="prSelectUser" name="prSelectUser" style="">
												<c:forEach var="row" items="${projectForm.userCol}"
													varStatus="rowStatus">
													<option value="<c:out value="${row.id}"/>">
														<c:out value="${row.fullName}" />
													</option>
												</c:forEach>
											</select>
										</td>
									</tr>
									<tr>
										<td style="width: 80px">
											<label for="prChkAchived">
												<strong>Achived: </strong>
											</label>
										</td>
										<td>
											<input id="prChkAchived" name="prChkAchived" type="checkbox" />
										</td>
									</tr>
									<tr>
										<td style="width: 80px">
											<label for="prStartDate">
												<strong>Start Date:</strong>
											</label>
										</td>
										<td>											
											<input id="prStartDate" name="prStartDate" type="text"
												value="" />
											<button id="prShowStartDate" title="Show Calendar"
												type="button">
												<img alt="Calendar" height="18"
													src="<%=request.getContextPath()%>/js/yui/assets/calbtn.gif"
													width="18">
											</button>											
										</td>
									</tr>
									<tr>
										<td>
											<label for="prFinishDate">
												<strong>Finish Date: </strong>
											</label>
										</td>
										<td>											
											<input id="prFinishDate" name="prFinishDate" type="text"
												value="" />
											<button id="prShowFinishDate" title="Show Calendar"
												type="button">
												<img alt="Calendar" height="18"
													src="<%=request.getContextPath()%>/js/yui/assets/calbtn.gif"
													width="18">
											</button>												
										</td>
									</tr>
									<tr>
										<td>
											<label for="prMail">
												<strong>Email: </strong>
											</label>
										</td>
										<td>
											<input type="text" id="prMail" name="prMail" />
										</td>
									</tr>
									<tr>
										<td>
											<label for="sPriority">
												<strong>Priority: </strong>
											</label>
										</td>
										<td>
											<select id="prPriority" name="prPriority">
												<option value="0">0</option>
												<option value="1">1</option>
												<option value="2">2</option>
												<option value="3">3</option>
												<option value="4">4</option>
												<option value="5">5</option>
											</select>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<label for="prEditor_decision">
									<strong>Decision Need: </strong>
								</label>
							</td>
							<td>
								<textarea id="prEditor_decision" cols="40"
									name="prEditor_decision" rows="10"> 								
								</textarea>
							</td>
						</tr>
						<tr>
							<td style="width: 80px">
								<label for="prPurpose">
									<strong>Purpose:</strong>
								</label>
							</td>
							<td style="width: 155px">
								<textarea id="prPurpose" cols="40"
									name="prPurpose" rows="10"> 								
								</textarea>
							</td>
							<td>
								<label for="prIdeaOutcome">
									<strong>Idea Outcome:</strong>
								</label>
							</td>
							<td>
								<textarea id="prIdeaOutcome" cols="40"
									name="prIdeaOutcome" rows="10"> 								
								</textarea>
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<div align="right">
									<input id="prTableIndex" type="hidden" />
									<input id="projectID" type="hidden" />
									<input onclick="addNewProject();" type="button" value="Submit" />
								</div>
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<div id="newMajorTaskError">
								</div>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	<!-- End Add new Project Task Dialog --></td></tr>
</Table>		
<script type="text/javascript">
var users = [];
var tmpUsers = "<bean:write name="projectForm" property="userList"/>";
tmpUsers = tmpUsers.replace(/&quot;/g, "");
tmpUsers = tmpUsers.replace("[", "");
tmpUsers = tmpUsers.replace("]", "");
users = tmpUsers.split(",");

var loginDlg, AddNewMajorDialog,AddNewProjectDialog;
var tableObjects = [];
var count = 0;
var myEditor_MajorTask,myEditor_keyIssues,myEditor_decision,myEditor_prMajorTask,myEditor_PrkeyIssues,myEditor_PrDecision,myEditor_Purpose,myEditor_IdeaOutcome;
var ContextPath = "<%=request.getContextPath()%>";
var isLogin = false;
YAHOO.util.Event.addListener(window, "load", function()
{
   init = function()
   {
		createDialog();
		<c:choose>
			<c:when test="${projectForm.userSession.username == ''}">
				 isLogin = false;
			</c:when>
			<c:otherwise>
				isLogin = true;				
			</c:otherwise>
		</c:choose>
		
	if(!isLogin)
	{
		loginDlg.show();
		return;
	}
      var content = document.getElementById("content");
      // Define the callback object for Connection Manager that will set the body of our content area when the content has loaded
      var callback =
      {
         success : function(o)
         {
            createListTable(o);
         }
         ,
         failure : function(o)
         {

         }
      }

      // Show the Panel

      var sUrl = "<%=request.getContextPath()%>/ProjectList.do?action=getAllProjectList";
      var postData = "";
      showWaitingDialog(sUrl, callback, postData, content);
      // End Get List Tabsle

      
      createEditor();
      ShowAdDiv();
	  LComplete = 1;
	  buildTree();

   }
   ();
}
);


</script>
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function()
{

   var Event = YAHOO.util.Event,
   Dom = YAHOO.util.Dom,
   dialog,
   calendar;

   var showStartDate = Dom.get("showStartDate");
   var showFinishDate = Dom.get("showFinishDate");
   var prShowStartDate = Dom.get("prShowStartDate");
   var prShowFinishDate = Dom.get("prShowFinishDate");

   Event.on(showStartDate, "click", function()
   {
      showCalendar(showStartDate, dialog, calendar, Dom, Event, "startDate","AddNewMajorDialog");
   }
   );
   Event.on(showFinishDate , "click", function()
   {
      showCalendar(showFinishDate , dialog, calendar, Dom, Event, "finishDate","AddNewMajorDialog");
   }
   );
   Event.on(prShowStartDate , "click", function()
   {
      showCalendar(prShowStartDate , dialog, calendar, Dom, Event, "prStartDate","AddNewVPMProjectDialog");
   }
   );
   Event.on(prShowFinishDate , "click", function()
   {
      showCalendar(prShowFinishDate , dialog, calendar, Dom, Event, "prFinishDate","AddNewVPMProjectDialog");
   }
   );
}
);

</script>
</div>
</html:form>
<!-- End Content -->
<%@include file="/jsp/common/footer.jspf"%>